package topic;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import utils.RabbitMQUtils;

import java.io.IOException;

public class Provider {
    public static void main(String[] args) throws IOException {
        Connection connection = RabbitMQUtils.getConnection();
        Channel channel = connection.createChannel();

        channel.exchangeDeclare("topics", "topic");

        String routingKey = "save.user.findAll";
        channel.basicPublish("topics", routingKey, null, ("发布动态路由消息" + routingKey).getBytes());

        RabbitMQUtils.closeConnectionAndChannel(channel, connection);
    }
}
